package com.qt.stream;

import java.util.*;
import java.util.stream.Stream;

/**
 * @Author:zsf
 */
public class StreamDemo01 {
    public static void main(String[] args) {

        //单列集合
        ArrayList<String> str = new ArrayList<>();
        LinkedList<String> strlinded = new LinkedList<>();
        Collections.addAll(str,"a","b","c","d","e");
        Collections.addAll(strlinded,"a","b","c","d","e");

        str.stream().forEach(s -> System.out.println(s));
        strlinded.stream().forEach(s -> System.out.println(s));

        System.out.println("------------------------------------");

        HashMap<String, String> strMap = new HashMap<>();
        strMap.put("1","a");
        strMap.put("2","b");
        Set<String> setList = strMap.keySet();
        setList.stream().forEach(s -> System.out.println(s));
        System.out.println("-----------------");
        Set<Map.Entry<String, String>> entries = strMap.entrySet();
        entries.stream().forEach(s -> System.out.println(s));
        System.out.println("-----------------");
        //数组
        String[] a = {"a","b","c","d","e"};
        int[] b =  {1,2,3,4,5};
        Arrays.stream(a).forEach(s -> System.out.println(s));
        System.out.println("-----------------");
        Stream.of("zhangsan","duziteng").forEach(s -> System.out.println(s));
        System.out.println("-----------------");
        Stream.of(a).forEach(s -> System.out.println(s));
        System.out.println("-----------------");
        Stream.of(b).forEach(s -> System.out.println(s));//[I@5fd0d5ae



    }
}
